package org.example.model.common;

public enum AppHttpCodeEnum {

    // 登录段1~50
    NEED_LOGIN(1,"需要登录后操作"),
    LOGIN_PASSWORD_ERROR(2,"密码错误"),
    // TOKEN50~100
    TOKEN_INVALID(50,"无效的TOKEN"),
    TOKEN_EXPIRE(51,"TOKEN已过期"),
    TOKEN_REQUIRE(52,"TOKEN是必须的"),
    // SIGN验签 100~120
    SIGN_INVALID(100,"无效的SIGN"),
    SIG_TIMEOUT(101,"SIGN已过期"),
    // 参数错误 500~1000
    PARAM_REQUIRE(500,"缺少参数"),
    PARAM_INVALID(501,"无效参数"),
    PARAM_IMAGE_FORMAT_ERROR(502,"图片格式有误"),
    SERVER_ERROR(503,"服务器内部错误"),
    // 数据错误 1000~2000
    DATA_EXIST(1000,"数据已经存在"),
//    AP_USER_DATA_NOT_EXIST(1001,"ApUser数据不存在"),
    DATA_NOT_EXIST(1002,"数据不存在"),
    // 数据错误 3000~3500
    NO_OPERATOR_AUTH(3000,"无权限操作"),
//    NEED_ADMIN(3001,"需要管理员权限"),

    // 默认成功提示
    SUCCESS(200,"操作成功"),
    // 操作成功 210~300
    QUERY_SUCCESS(210, "查询成功"),
    SAVE_SUCCESS(211, "添加成功"),
    UPDATE_SUCCESS(212, "修改成功"),
    DELETE_SUCCESS(213, "删除成功"),
    IMAGE_UPLOAD_SUCCESS(214, "图片上传成功"),
    // 操作失败 310~400
    QUERY_ERROR(310, "查询失败"),
    SAVE_ERROR(311, "添加失败"),
    UPDATE_ERROR(312, "修改失败"),
    DELETE_ERROR(313, "删除失败"),
    IMAGE_UPLOAD_ERROR(314, "图片上传失败");

    private final int code;
    private final String errorMessage;

    AppHttpCodeEnum(int code, String errorMessage){
        this.code = code;
        this.errorMessage = errorMessage;
    }

    public int getCode() {
        return code;
    }

    public String getErrorMessage() {
        return errorMessage;
    }
}
